<?php

App::uses('AppController', 'Controller');

class CeneController extends AppController {
    
    public $pageTitle = 'Cenovnik';
    public $uses      = array('Price');
    
    public function index() {
        $prices = array();
        foreach ($this->Price->find('all') as $p) {
            $group = $p['PriceGroup']['name'];
            if (empty($prices[$group])) {
                $prices[$group] = array();
            }
            $prices[$group][] = $p;
        }
        
        $this->set('prices', $prices);
    }
    
}